<style>
    .btn.btn-default-o{
        border-radius: 1rem;
        line-height: 1.1rem;
        height: 1.2rem;
        padding: 0 1rem;
        font-size: .6rem;
    }
    .towline{
        color: #000;
        font-size: 0.7rem;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        white-space: normal;
    }
    .fui-list-inner .text{
        display: -webkit-box;
        display: -webkit-flex;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;
        font-size: .7rem;
        color: #000;
    }
    .goods-selected .fui-list-inner{
        height: 4rem;
        display: -webkit-box;
        display: -webkit-flex;
        display: flex;
        flex-direction: column;
        -webkit-flex-direction: column;
        justify-content: space-between;
        -webkit-justify-content: space-between;
    }
</style>
<div class="fui-page fui-page page-commission-selectgoods">
    <div class="fui-header">
        <div class="fui-header-left">
            <a class="back" ng-click="goback()"></a>
        </div>
        <div class="title">选择商品</div>
		<div class="fui-header-right" style="margin-right:0.5rem">
			<span class="btn btn-sm btn-danger-o" style="border-radius:1rem;" ng-click="pagedata.showzhuan=true;">提交选择</span>
		</div>
    </div>
    <div class="fui-content navbar">
	<div class="fui-fullHigh-group" >
      
        <div class="fui-fullHigh-item menu" id="tab">
            <nav ng-class="{'on':pagedata.params.order =='all'}" ng-click="pagedata.getlist('all',0)">全部商品</nav>
			<nav ng-class="{'on':pagedata.params.order =='isnew'}" ng-click="pagedata.getlist('isnew',0)">新上宝贝</nav>
			<nav ng-class="{'on':pagedata.params.order =='isrecommand'}" ng-click="pagedata.getlist('isrecommand',0)">推荐宝贝</nav>
			<div ng-repeat="c1 in pagedata.category">
				<nav ng-class="{'on':pagedata.params.pid ==c1.id}" ng-click="pagedata.getlist('',c1.id)" ng-show="!c1.enabled && pagedata.shopset.category.level !='-1'">{{c1.title}}</nav>
			</div>
        </div>
        <div class="fui-fullHigh-item container">
              <div class="searchbar" style='margin:0;padding:0'>
                    <div class="search-input">
                        <i class="icon icon-search" ng-click="access(pagedata.op,made_query(pagedata.params))"></i>
                        <input type="search" id='keywords' ng-model="pagedata.params.keyword" placeholder="输入关键字..." style="border: 1px solid #f7f7f7;">
                    </div>
              </div>
				<p ng-if="pagedata.list.length<1" class="text-center text-cancel empty" style="margin-top:2rem;color:#999">暂时没有任何商品</p>
				<div class="fui-list-group goods-list-group" style="margin-top:0;">
					<div ng-repeat="g in pagedata.list" class="fui-list goods-item">
							<div class="fui-list-media">
								<img ng-src="{{tomedia(g.image) || '../core/resource/images/nopic.jpg'}}" class='round'/>
							</div>
							<div class='fui-list-inner'>
								<div class='subtitle'>{{g.title}}</div>
								<div class='text'>
								<span class='text-danger'>￥{{g.price}}</span>
								<span class='text-danger'>会员:￥{{g.buyprice}}</span>
								
								</div>
								<div class='text'>
								<span ng-if="!g.isadd"><input type="checkbox" value="{{g.id}}" ng-checked="pagedata.goodsids.indexOf(';'+g.id+';')>=0" ng-click="pagedata.goselect(g.id,'goodsids')" class="fui-switch fui-switch-warning fui-switch-small"/></span>
								<span ng-if="g.isadd" class='subtitle'>已添加</span>
								</div>
							</div>
					</div>
				</div>
				<div ng-if="pagedata.loading" class='infinite-loading'><span class='fui-preloader'></span><span class='text'> 正在加载...</span></div>   
        </div> 
    </div>
</div>
</div>
<div ng-if="pagedata.showzhuan" class="popup">
	<div class="popup-body">
		<div class="popup-center" style="background:#fc6d60">
			<style>
				input{ caret-color: #fff}
				.fui-cell-group .fui-cell .fui-cell-info  ::-webkit-input-placeholder{
					color: #fff
				}
				.fui-cell-group .fui-cell .fui-cell-info {
					font-size: 0.85rem;
					color: #fff;
				}
			</style>
			<i class="closed icon icon-cuowu" ng-click="pagedata.showzhuan=false"></i>
			 <div class='fui-cell-group fui-cell-group-o' style="margin:0.5rem 2rem;padding-top:0.5rem;background:#fc6d60">
				<div class='fui-cell-title c' style="color:#fff">您正在“批量采集商品”操作
				</div>
				<div class='fui-cell'>
					<div class='fui-cell-label big' style='width:auto;color:#fff'><i class="icon icon-jifen" style="font-size:0.8rem"></i> 加价：</div>
					<div class='fui-cell-info'>
						<input type='text' class='fui-input' placeholder="0.00" style='font-size:1.2rem;' ng-model="pagedata.post.addprice">
					</div>
				</div>
				<div class='fui-cell-title c' style="color:#fff;font-size:0.6rem">填数字，直接加固定金额，加%，表示按比例加价！比如填10%，表示加价10%</div>
			</div>
			<div class="weui_btn_area" style="margin:2rem;">
				<a class='weui_btn weui_btn_primary' style="border-radius:1rem;background-color:#fff;color:#fc6d60" ng-click="post(pagedata.post,'jy_merch/manage.selectgoods/post/')">确认采集</a>
			</div>
		</div>
	</div>
</div>
<div ng-include="sys_html('_footer')"></div>
<script>
scope.pagedata.loading = true;  //状态标记
scope.isnodata = false;
scope.pagedata.list =[];
scope.pagedata.params.order ='all'
//滚动加载
scope.pagedata.params.keyword = ''
scope.pagedata.getlist=function(order,pid){
	scope.pagedata.params.order = order;
	scope.pagedata.params.pid=pid;
	scope.tool.get_list('jy_merch/manage.selectgoods/getlist/',true);
	scope.$evalAsync();
}
scope.tool.get_list('jy_merch/manage.selectgoods/getlist/',true);
scope.pagedata.scroll_bottom=function(){
	scope.tool.get_list('jy_merch/manage.selectgoods/getlist/');
}
scope.pagedata.goselect=function(value,field){
	var goodsids = scope.pagedata.post.goodsids;
		if(goodsids==undefined || goodsids==''){
			goodsids=';';
		}
		if(goodsids.indexOf(';'+value+';')<0){
			goodsids=goodsids+value+';';
		}else{
			goodsids=goodsids.replace(';'+value+';',';');
			if(goodsids==';'){
				goodsids='';
			}
		}
	scope.pagedata.post.goodsids = goodsids
}
</script>